//
//  CommonInfo.m
//  HWZB
//
//  Created by 许成雄 on 2017/4/29.
//  Copyright © 2017年 wonders. All rights reserved.
//

#import "CommonInfo.h"

@implementation CommonInfo

+ (NSDictionary *)JSONKeyPathsByPropertyKey {
    return @{
             @"code" : @"errorCode",
            @"msg" : @"message"
             };
}

+ (NSValueTransformer *)codeJSONTransformer {
    return [MTLValueTransformer transformerWithBlock:^id(id value) {
        if([value isKindOfClass:[NSNumber class]]) {
            return [value stringValue];
        } else {
            return (NSString *)value;
        }
    }];
}

- (BOOL)isSuccess {
    return [self.code.uppercaseString isEqualToString:@"SUCCESS"];
}

@end
